package com.glsc.ngateway.common.base.converter.platform;

import com.alibaba.excel.util.CollectionUtils;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow.FlowFormEquipmentApplyCloudDeviceDetail;
import com.glsc.ngateway.common.base.domainmapper.FlowFormEquipmentApplyCloudDeviceDetailMapper;
import com.glsc.ngateway.common.api.flowable.dto.task.formData.equipment.domainDto.FlowFormEquipmentApplyCloudDeviceDetailDto;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * FlowFormEquipmentApplyCloudDeviceDetail转换器
 * @author xuchang
 */
public class FlowFormEquipmentApplyCloudDeviceDetailConverter extends AbstractFlowFormDataConverter {
    public static FlowFormEquipmentApplyCloudDeviceDetailDto do2Dto(FlowFormEquipmentApplyCloudDeviceDetail detail) {
        if (Objects.isNull(detail)) {
            return null;
        }
        return FlowFormEquipmentApplyCloudDeviceDetailMapper.INSTANCE.domain2dto(detail);
    }

    public static List<FlowFormEquipmentApplyCloudDeviceDetailDto> do2Dto(List<FlowFormEquipmentApplyCloudDeviceDetail> detailList) {
        return CollectionUtils.isEmpty(detailList) ? java.util.Collections.emptyList() : detailList.stream().map(FlowFormEquipmentApplyCloudDeviceDetailConverter::do2Dto).collect(Collectors.toList());
    }

    public static FlowFormEquipmentApplyCloudDeviceDetail dto2Do(FlowFormEquipmentApplyCloudDeviceDetailDto detailDto) {
        if (Objects.isNull(detailDto)) {
            return null;
        }
        return FlowFormEquipmentApplyCloudDeviceDetailMapper.INSTANCE.dto2domain(detailDto);
    }

    public static List<FlowFormEquipmentApplyCloudDeviceDetail> dto2Do(List<FlowFormEquipmentApplyCloudDeviceDetailDto> detailDtoList) {
        return CollectionUtils.isEmpty(detailDtoList) ? java.util.Collections.emptyList() : detailDtoList.stream().map(FlowFormEquipmentApplyCloudDeviceDetailConverter::dto2Do).collect(Collectors.toList());
    }

}
